package polyparameter;

public class Employee {
    private String name;
    private double salary;

    public Employee(String name, double salary) {
        this.name = name;
        setSalary(salary);
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setSalary(double salary) {
        if(salary >= 1){
          this.salary = salary;
        }
    }

    public double getSalary() {
        return salary;
    }
    //计算年工资
    public double getAnnual(){
        return  12 * salary;
    }
}
